/*
 * Copyright (c) 2015-2018 Sfkj Science And Technology Co.,Ltd.
 * All Rights Reserved.
 * This software is the confidential and proprietary information of
 * Sfkj Science And Technology Co.,Ltd.
 * ("Confidential Information").You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Sfkj.
 */
package org.axonframework.domain;

import com.google.common.base.Preconditions;
import lombok.*;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Setter(AccessLevel.PROTECTED)
@Getter
@ToString
@EqualsAndHashCode(of = {"start", "end"})
public class DateTimeRange implements java.io.Serializable {

    @NotNull
    private LocalDateTime start, end;

    public DateTimeRange(LocalDateTime start, LocalDateTime end) {
        Preconditions.checkState(start.isBefore(end), "开始必须小于结束");

        this.start = start;
        this.end = end;
    }

}
